package com.itzol.controller;



import com.itzol.uitls.CosUtil;
import com.itzol.uitls.Result;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author linxin
 * @since 2022-03-09
 */
@RestController
public class PostController {

    @PostMapping("/post")
    public Result post(@RequestParam("file") MultipartFile file){
        if (file == null){
            return Result.fail("上传文件为空");
        }
        String uploadfile = CosUtil.uploadfile(file);
        return Result.succ(uploadfile);
    }
}

